﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace PineLake.Drmwe.Lib.ConvertModel
{
    /// <summary>
    /// 实体转换成List
    /// </summary>
    public static class ModelConvertToList
    {
        /// <summary>
        /// 实体类的属性转换成LIST
        /// </summary>
        /// <typeparam name="T">实体类</typeparam>
        /// <returns></returns>
        public static List<string> ConvertModelToList<T>()
        {
            var ModelList = new List<string>();
            Type EntityType = typeof(T);
            System.Reflection.PropertyInfo[] Properties = EntityType.GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
            if (Properties.Count() > 0)
            {
                foreach (PropertyInfo item in Properties)
                {
                    ModelList.Add(item.Name);
                }
            }
            return ModelList;
        }
    }
}
